package com.syezon.wifikey.base;

import android.app.Activity;
import android.view.View;

import com.syezon.android.base.eventbus.EventCenter;
import com.tbruyelle.rxpermissions2.RxPermissions;

import io.reactivex.functions.Consumer;

/**
 * Created by Administrator on 2018/9/7.
 */

public class BaseFragment extends com.syezon.android.base.ui.BaseFragment {
    private RxPermissions permissions;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        permissions = new RxPermissions(activity);
    }

    protected void requestPermission(final PermissionCallBack callBack, final String... permission) {
        permissions.request(permission).subscribe(new Consumer<Boolean>() {
            @Override
            public void accept(Boolean aBoolean) throws Exception {
                callBack.onResult(aBoolean, permission);
            }
        });
    }

    @Override
    protected View getLoadingTargetView() {
        return null;
    }

    @Override
    protected void initViewsAndEvents() {

    }

    @Override
    protected int getContentViewLayoutID() {
        return 0;
    }

    @Override
    protected void onEventComming(EventCenter eventCenter) {

    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }
}
